/*
Copyright (c) 2019 Alibaba Group Holding Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
//*******************************
//             MAILBOX
//*******************************
#ifndef __MAILBOX_H_
#define __MAILBOX_H_

#include "my_sys.h"

//*******************************
//             RM
//*******************************

#define REE2TEE_BASE 0x40010000

#define REE2TEE_REG0 0X00
#define REE2TEE_DONE 0X04
#define REE2TEE_REG2 0X08
#define REE2TEE_REG3 0X0C
#define REE2TEE_ACCESS_ERROR 0X10

extern void Polling_Tee_Process_Done(void);
extern void Send_Ree_process_Done_Flag(void);
extern void Clean_Ree_process_Done_Flag(void);
extern void Send_cmd_to_Ree_box(u32 cmd,u32 offset_addr);

//*******************************
//             TM
//*******************************

#define TEE2REE_BASE 0x40020000

#define TEE2REE_REG0 0X00
#define TEE2REE_DONE 0X04
#define TEE2REE_REG2 0X08
#define TEE2REE_REG3 0X0C
#define TEE2REE_ACCESS_ERROR 0X10

extern void Polling_Ree_Process_Done(void);
extern void Send_Tee_process_Done_Flag(void);
extern void Clean_Tee_process_Done_Flag(void);
extern void Send_cmd_to_Tee_box(u32 cmd,u32 offset_addr);

//*******************************
//             RBM
//*******************************

#define RBM_A_BASE 0x10000000
#define RBM_B_BASE 0x30000000

extern void Ree_Send_Data2tee (u32* data,u32 addr);
extern void Ree_Read_Data_From_Tee (u32* data,u32 addr,u32 len);
extern void Ree_Read_Data_From_Ree (u32* data,u32 addr,u32 len);
//*******************************
//             TBM
//*******************************

#define TBM_A_BASE 0x40100000
#define TBM_B_BASE 0x80000000

extern void Tee_Send_Data2ree (u32* data,u32 addr);
extern void Tee_Read_Data_From_Ree (u32* data,u32 addr,u32 len);
extern void Tee_Read_Data_From_Tee (u32* data,u32 addr,u32 len);



// typedef struct
// {
//  uint32_t WRC;//pmu_weakup_ree_core
//  uint32_t SPR;//pmu_set_pc_rst
//  uint32_t SIL;//pmu_set_iram_len
//  uint32_t IDE;//pmu_iram_dec_en
//  uint32_t SIA;//pmu_set_iram_addr
// }PMU_TypeDef;

// typedef struct
// {
//  uint32_t pmu_set_iram_len;//pmu_set_iram_len
//  uint32_t pmu_set_iram_addr;//pmu_set_iram_addr
//  FunctionalState pmu_iram_dec_en;//pmu_iram_dec_en
// }PMU_InitTypeDef;


#endif